{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# ***Introduction to Radar Using Python and MATLAB***\n",
    "## Andy Harrison - Copyright (C) 2019 Artech House\n",
    "<br/>\n",
    "\n",
    "# Minimum Detectable Signal\n",
    "***"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "The minimum detectable signal may be written as (Equation 4.38)\n",
    "\n",
    "$$\n",
    "P_{min} = k\\,T_0\\,B\\,F\\,L\\,({SNR}_o)_{min} \\hspace{0.5in} \\text{(W)}\n",
    "$$\n",
    "***"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Begin by getting the library path"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "import lib_path"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Set the system temperature, bandwidth, noise figure, losses and signal to noise ratio"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "system_temperature = 290.0\n",
    "\n",
    "bandwidth = 10e6\n",
    "\n",
    "noise_figure = 3.0\n",
    "\n",
    "losses = 4.0\n",
    "\n",
    "signal_to_noise = 20.0"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Set up the keyword args"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [],
   "source": [
    "kwargs = {'system_temperature': system_temperature,\n",
    "\n",
    "          'bandwidth': bandwidth,\n",
    "\n",
    "          'noise_factor': 10.0 ** (noise_figure / 10.0),\n",
    "\n",
    "          'losses': 10.0 ** (losses / 10.0),\n",
    "\n",
    "          'signal_to_noise': 10.0 ** (signal_to_noise / 10.0)}"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Import the `minimum_detectable_signal` routine"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [],
   "source": [
    "from Libs.radar_range import radar_range"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Calculate the minimum detectable signal and display the result in Watts"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "2.01e-11\n"
     ]
    }
   ],
   "source": [
    "mds = radar_range.minimum_detectable_signal(**kwargs)\n",
    "\n",
    "print('{:.2e}'.format(mds))"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.5"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
